package zdream.rockchronicle.foes.mm;

import zdream.control.foe.mm.RushJet;
import zdream.control.world.Ticker;
import zdream.rockchronicle.RockChronicle;
import zdream.rockchronicle.core.graphics.FoePainter;

/**
 * @author Zdream
 * @since 0.0.1
 * @date 2022-06-03 (last modified)
 */
public class RushJetPainter extends FoePainter {
	private final RushJet owner;

	public RushJetPainter(RushJet owner) {
		super(owner);
		super.z = 1004;
		this.owner = owner;
		this.batch = RockChronicle.INSTANCE.graphics.batch;
	}

	/**
	 * 使用的 Sprite 的形态
	 */
	String motion = "normal";

	@Override
	public void draw(Ticker ticker) {
		tick(ticker);
		super.draw(ticker);
	}

	private void tick(Ticker ticker) {
		if (owner.motionModule.prepareDuration > 0) {
			motion = "open";
		} else {
			motion = "normal";
		}
		setState(motion);
	}

	/**
	 * RushJet 是否闪烁和 immune 参数无关, 和自己的位置 / 洛克人的位置有关
	 * 离得太远就会闪烁
	 */
	@Override
	protected void checkEffects() {
		// do-nothing
	}
}
